package Ms

//
//import (
//	"bytes"
//	"database/sql"
//	"errors"
//	"fmt"
//	"db2s/dataDispos"
//	"db2s/global"
//	"db2s/outPut"
//	"reflect"
//	"runtime"
//	"strconv"
//	"strings"
//	"time"
//)
//
//type GeneralSql struct {
//	Schema             string
//	Table              string
//	IgnoreColumnLength bool     //是否忽略表的字段长度和行长度不匹配问题，true表示忽略
//	IndexType          string   //判断索引类型
//	IndexColumn        []string //索引列数据
//	IndexName          any      //索引名
//	LobSwitch          bool     //判断是否是lob，lob使用预处理，非lob采用多value
//	Esa                global.EncryptionProperties
//}
//type ApplySql struct {
//	Schema     string
//	Table      string
//	DB         map[string]*sql.DB
//	LobSwitch  bool
//	WriteTextI any  `json:"writeTextI"`
//	SqlMode    bool //是否保留sqlmode，true保留，false 清空
//	SqlLogBin  bool //是否保留binlog，true保留，false清空
//}
//
//func (or GeneralSql) rowsValueConvertDispos(c, v string) string {
//	var tmpcolumnName string
//	if strings.EqualFold(v, "<entry>") {
//		tmpcolumnName = fmt.Sprintf("''")
//	} else if strings.EqualFold(v, "<nil>") {
//		tmpcolumnName = fmt.Sprintf("NULL")
//	} else {
//		//if strings.ToUpper(c) == "DATETIME" {
//		//	tmpcolumnName = fmt.Sprintf("'%v'", v)
//		//	//tmpcolumnName = fmt.Sprintf("TO_DATE('%s','YYYY-MM-DD HH24:MI:SS')", v)
//		//} else if strings.Contains(strings.ToUpper(c), "TIMESTAMP") {
//		//	tmpcolumnName = fmt.Sprintf("'%v'", v)
//		//	//tmpcolumnName = fmt.Sprintf("TO_DATE('%s','YYYY-MM-DD HH24:MI:SS')", v)
//		//} else {
//		tmpcolumnName = fmt.Sprintf("'%v'", v)
//		//}
//	}
//	if strings.HasPrefix(strings.ToUpper(c), "NUMBER") && len(v) == 0 {
//		tmpcolumnName = fmt.Sprintf("NULL")
//	}
//	if (strings.ToUpper(c) == "DATETIME" || strings.ToUpper(c) == "DATE" || strings.Contains(strings.ToUpper(c), "TIMESTAMP")) && len(v) == 0 {
//		tmpcolumnName = fmt.Sprintf("NULL")
//	}
//	return tmpcolumnName
//}
//
//// rowsCutting 行数据按分割符进行列分割
//func rowsCutting(s string, symbol string) []*string {
//	s = fmt.Sprintf("%v%v", s, symbol)
//	startIndex := 0
//	var e []*string
//	for {
//		index := strings.Index(s[startIndex:], symbol)
//		if index == -1 {
//			break
//		}
//		line := s[startIndex : startIndex+index]
//		if len(line) == 0 {
//			line = ""
//		}
//		e = append(e, &line)
//		startIndex += index + len(symbol)
//	}
//	return e
//}
//
///*
//表的列类型处理
//*/
//func (or GeneralSql) tableColumnDispos(colData []map[string]string, indexColumn []string, indexType string) ([]string, map[string]string) {
//	var (
//		FB  []string
//		acc = make(map[string]string) //判断特殊数据类型
//	)
//	for _, i := range colData {
//		if indexType == "pri" || indexType == "uni" {
//			for _, v := range indexColumn {
//				if strings.EqualFold(v, i["columnName"]) {
//					FB = append(FB, i["columnSeq"])
//				}
//			}
//		} else if indexType == "mui" {
//			FB = append(FB, i["columnName"])
//		}
//		if strings.HasPrefix(i["dataType"], "double(") {
//			acc["double"] = i["columnName"]
//		}
//	}
//	return FB, acc
//}
//func (or GeneralSql) tableColumnConvertDispos(c, v string, F map[string]string) string {
//	if v == "<nil>" {
//		return fmt.Sprintf(" %s is null ", c)
//	}
//	if v == "<entry>" {
//		return fmt.Sprintf(" %s = ''", c)
//	}
//	if c == F["double"] {
//		return fmt.Sprintf("  concat(%s,'') = '%s'", c, v)
//	}
//	return fmt.Sprintf(" \"%s\" = '%s' ", c, v)
//}
//
//// Prefix 生产
//func (or GeneralSql) Prefix(s any) (any, error) {
//	var (
//		tableName    string
//		insertPrefix string
//	)
//	s1 := s.(global.GeneralSqlInput)
//	if !strings.EqualFold(s1.PartitionName, "single") && len(s1.PartitionName) > 0 {
//		tableName = fmt.Sprintf(" \"%v\".\"%v\" PARTITION (\"%v\")", or.Schema, or.Table, s1.PartitionName)
//	} else {
//		tableName = fmt.Sprintf(" \"%v\".\"%v\" ", or.Schema, or.Table)
//	}
//	insertPrefix = fmt.Sprintf("%s ", fmt.Sprintf("INSERT INTO %v (\"%s\") VALUES", tableName, strings.Join(s1.InsertColumn, "\",\"")))
//	if or.LobSwitch {
//		insertPrefix = fmt.Sprintf("INSERT INTO %v (\"%s\") VALUES (%s)", tableName, strings.Join(s1.InsertColumn, "\",\""), strings.Join(s1.PlaceholderValue, ","))
//	}
//	return insertPrefix, nil
//}
//
///*
//Insert 生成insert语句前缀
//*/
//func (or GeneralSql) Insert(s any) (any, error) {
//	//查询该表的列名和列信息
//	var (
//		sqlPrefix     string
//		buff          bytes.Buffer
//		esaColumnSeq  = make(map[int]int)
//		esaColumnName = make(map[string]int)
//		err           error
//		event         = "[Insert]"
//	)
//	s1 := s.(global.GeneralSqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v table %s.%s starts to generate insert repair statement.", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//
//	//处理orsql查询时间列时数据带时区问题  2021-01-23 10:16:29 +0800 CST
//	r := rowsCutting(s1.RowData, string(ColumnDataSplict))
//	var insertValueColumn = make([]string, len(s1.ColData))
//	for _, v := range or.Esa.ColumnSlice {
//		esaColumnName[v]++
//	}
//	for k, v := range s1.ColData {
//		if v1, ok := v["columnName"]; ok {
//			insertValueColumn[k] = v1
//			if _, ok1 := esaColumnName[v1]; ok1 {
//				var seq int
//				if seq, err = strconv.Atoi(v["columnSeq"]); err != nil {
//					return "", err
//				}
//				esaColumnSeq[seq-1]++
//			}
//		}
//	}
//	if len(r) != len(s1.ColData) {
//		if or.IgnoreColumnLength && len(s1.ColData) > len(r) {
//			global.Wlog.Warn(fmt.Sprintf("(%d) %v %v table %s.%s rows Data length != table column Data. column data is {%v},rows data is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, s1.ColData, r))
//		} else {
//			global.Wlog.Error(fmt.Sprintf("(%d) %v %v table %s.%s rows Data length != table column Data. column data is {%v},rows data is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, s1.ColData, r))
//			return "", errors.New(fmt.Sprintf("column length abnormal"))
//		}
//	}
//	for k, v := range r {
//		var l = *v
//		if strings.Contains(l, "\\") {
//			l = strings.ReplaceAll(l, "\\", "\\\\")
//		}
//		if strings.Contains(l, "'") {
//			l = strings.ReplaceAll(l, "'", "\\'")
//		}
//		if strings.Contains(l, ";") {
//			l = strings.ReplaceAll(l, ";", "\\;")
//		}
//		columnVal := or.rowsValueConvertDispos(s1.ColData[k]["dataType"], l)
//		if _, ok := esaColumnSeq[k]; ok && len(or.Esa.LockFuncName) > 0 {
//			columnVal = fmt.Sprintf("%v.%v(%v)", or.Schema, or.Esa.LockFuncName, columnVal)
//		}
//		buff.WriteString(fmt.Sprintf("%s%s", columnVal, global.DataColumnsSplist))
//	}
//	sf := buff.String()
//	if strings.HasSuffix(sf, global.DataColumnsSplist) {
//		sf = sf[:len(sf)-len(global.DataColumnsSplist)]
//	}
//	sqlPrefix = sf
//	buff.Reset()
//	vlog = fmt.Sprintf("(%d) %v %v The insert repair statement of table a is generated. result is {%v}", s1.LogSeq, callFuncInfo, event, sqlPrefix)
//	global.Wlog.Debug(vlog)
//	return sqlPrefix, nil
//}
//
///*
//Delete 生成delete 修复语句
//*/
//func (or GeneralSql) Delete(s any) (any, error) {
//	var (
//		deleteSql, deleteSqlWhere string
//		AS                        []string
//		event                     = "[FixDeleteSqlExec]"
//	)
//	s1 := s.(global.GeneralSqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v table %s.%s starts to generate delete repair statement.", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//
//	FB, F := or.tableColumnDispos(s1.ColData, or.IndexColumn, or.IndexType)
//	for k, v := range strings.Split(s1.RowData, string(ColumnDataSplict)) {
//		if strings.Contains(v, "'") {
//			v = strings.ReplaceAll(v, "'", "\\'")
//		}
//		if or.IndexType == "mui" {
//			AS = append(AS, or.tableColumnConvertDispos(FB[k+1], v, F))
//		} else if or.IndexType == "pri" || or.IndexType == "uni" {
//			for l, I := range FB {
//				if I == strconv.Itoa(k+1) {
//					AS = append(AS, or.tableColumnConvertDispos(or.IndexColumn[l], v, F))
//				}
//			}
//		}
//	}
//	if deleteSqlWhere = strings.Join(AS, " and "); len(deleteSqlWhere) > 0 {
//		deleteSql = fmt.Sprintf("delete from `%s`.`%s` where %s;", or.Schema, or.Table, deleteSqlWhere)
//	}
//	global.Wlog.Debug(fmt.Sprintf("(%d) %v %v Generate delete statement successfully, sql is %s", s1.LogSeq, callFuncInfo, event, deleteSql))
//	return deleteSql, nil
//}
//
//// Alter 生成alter 语句
//func (or GeneralSql) Alter(s any) (any, error) {
//	var (
//		sqlS   []string
//		indexS []string
//		event  = "[FixAlterIndexSqlExec]"
//	)
//	s1 := s.(global.GeneralSqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v Start generating index repair statements for table %v.%v.", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	switch fmt.Sprintf("%v", reflect.TypeOf(or.IndexName)) {
//	case "string":
//		indexS = []string{or.IndexName.(string)}
//	case "[]string":
//		for _, v := range or.IndexName.([]string) {
//			indexS = append(indexS, v)
//		}
//	}
//	for _, v := range indexS {
//		var c []string
//		for _, vi := range s1.IndexData[v] {
//			if len(strings.Split(vi, string(AlterDataSplict))) > 0 {
//				c = append(c, strings.TrimSpace(strings.Split(vi, string(AlterDataSplict))[0]))
//			}
//		}
//		if strings.EqualFold(s1.AlterType, "add") {
//			switch or.IndexType {
//			case "pri":
//				sqlS = append(sqlS, fmt.Sprintf("alter table `%s`.`%s` add primary key(`%s`);", or.Schema, or.Table, strings.Join(c, "`,`")))
//			case "uni":
//				sqlS = append(sqlS, fmt.Sprintf("alter table `%s`.`%s` add unique index %s(`%s`);", or.Schema, or.Table, v, strings.Join(c, "`,`")))
//			case "mul":
//				sqlS = append(sqlS, fmt.Sprintf("alter table `%s`.`%s` add index %s(`%s`);", or.Schema, or.Table, v, strings.Join(c, "`,`")))
//			}
//		} else if strings.EqualFold(s1.AlterType, "drop") {
//			switch or.IndexType {
//			case "pri":
//				sqlS = append(sqlS, fmt.Sprintf("alter table `%s`.`%s` drop primary key;", or.Schema, or.Table))
//			case "uni":
//				sqlS = append(sqlS, fmt.Sprintf("alter table `%s.`%s drop index %s;", or.Schema, or.Table, v))
//			case "mul":
//				sqlS = append(sqlS, fmt.Sprintf("alter table `%s`.`%s` drop index %s;", or.Schema, or.Table, v))
//			}
//		}
//	}
//	vlog = fmt.Sprintf("(%d) %v %v The index repair statement for table a is completed. result is {%v}", s1.LogSeq, callFuncInfo, event, sqlS)
//	global.Wlog.Debug(vlog)
//	return sqlS, nil
//}
//
//// Insert 应用插入sql语句
//func (or ApplySql) Insert(s any) (any, error) {
//	var (
//		setVariables []string
//		event        = "[ApplyInsert]"
//		execTimeout  int64
//		shardName    string
//		err          error
//	)
//	s1 := s.(global.ApplySqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	shardName = "single"
//	vlog = fmt.Sprintf("(%d) %v %v Table %v.%v starts executing the insert repair statement", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	if len(shardName) == 0 {
//		global.Wlog.Warn(fmt.Sprintf("(%d) %v %v The execution of a sql statement failed! table is %v.%v. error is {shardName is entry}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table))
//		for _, v := range s1.ApplySqlGather {
//			runtime.SetFinalizer(v, nil)
//		}
//		return nil, errors.New(fmt.Sprintf("%v", "shardName is entry"))
//	}
//	dispos := dataDispos.InstanceActiveS{SessionSet: setVariables, LobSwitch: or.LobSwitch, DB: s1.DB[shardName]}
//	if execTimeout, err = dispos.TrxInsert(s1.ApplySqlGather); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. table is %v.%v,error is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. table is %v.%v, exec timeout is {%vms}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, execTimeout)
//	global.Wlog.Debug(vlog)
//	return execTimeout, err
//}
//
//// Delete 应用插入sql语句
//func (or ApplySql) Delete(s any) (any, error) {
//	var (
//		setVariables []string
//		event        = "[ApplyDelete]"
//		execTimeout  int64
//		shardName    string
//		err          error
//	)
//	s1 := s.(global.ApplySqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	shardName = "single"
//	vlog = fmt.Sprintf("(%d) %v %v Table %v.%v starts executing the delete repair statement", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	dispos := dataDispos.InstanceActiveS{SessionSet: setVariables, LobSwitch: or.LobSwitch, DB: s1.DB[shardName]}
//	if execTimeout, err = dispos.TrxInsert(s1.ApplySqlGather); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. table is %v.%v,error is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. table is %v.%v, exec timeout is {%vms}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, execTimeout)
//	global.Wlog.Debug(vlog)
//	return execTimeout, nil
//}
//
//// Alter 应用插入sql语句
//func (or ApplySql) Alter(s any) (any, error) {
//	var (
//		event        = "[ApplyAlter]"
//		setVariables []string
//		execTimeout  int64
//		shardName    string
//		err          error
//		sqlText      *string
//	)
//	s1 := s.(global.ApplySqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v Table %v.%v starts executing the alter repair statement", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	shardName = "single"
//	dispos := dataDispos.InstanceActiveS{SessionSet: setVariables, DB: s1.DB[shardName]}
//	if _, sqlText, err = dispos.TrxAlterUpdate(s1.ApplySqlGather); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. table is %v.%v, sqlText is {%v} error is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, *sqlText, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. table is %v.%v, exec timeout is {%vms}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, execTimeout)
//	global.Wlog.Debug(vlog)
//	return execTimeout, nil
//}
//
//// Analyze analyze table 收集统计信息
//func (or ApplySql) Analyze(s any) (any, error) {
//	var (
//		//setVariables = []string{"SET session unique_checks=0", "SET session foreign_key_checks=0"}
//		event       = "[ApplyAnalyze]"
//		execTimeout int64
//		//shardName    string
//		//err          error
//	)
//	s1 := s.(global.ApplySqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v Table %v.%v starts executing the analyze table statement", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	//shardName = "single"
//	//if !or.SqlMode {
//	//	setVariables = append(setVariables, "set session sql_mode=''")
//	//}
//	//dispos := dataDispos.DBdataDispos{SessionSet: setVariables, DB: s1.DB[shardName], SqlLogBin: or.SqlLogBin}
//	/*
//		orsql 单机bug，lower_case_table_names = 1 , use schema xxx ,执行analyze table 表名为大写时，不收集统计信息，只能改为小写
//	*/
//	//analyzeTable := fmt.Sprintf("analyze table `%s`", strings.ToLower(or.Table))
//	//use := fmt.Sprintf("use `%s`", or.Schema)
//	//sqlstr := []*string{&use, &analyzeTable}
//	//if execTimeout, err = dispos.BeginTrxUpdate(sqlstr); err != nil {
//	//	vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. sql is {%v},error is {%v}", s1.LogSeq, callFuncInfo, event, sqlstr, err)
//	//	global.Wlog.Error(vlog)
//	//	return nil, err
//	//}
//	//vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. sql is {%v}, exec timeout is {%vms}", s1.LogSeq, callFuncInfo, event, sqlstr, execTimeout)
//	//global.Wlog.Debug(vlog)
//	return execTimeout, nil
//}
//
//func (or ApplySql) DmlSql(s any) (any, error) {
//	var (
//		sqlCommit []*string
//		begin     = "begin;\n"
//		commit    = "commit;\n"
//		event     = "[WriteDataFix]"
//		err       error
//	)
//	s1 := s.(global.ApplySqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	beginTime := time.Now()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v  Start writing repair statements of table %v.%v to the repair file.", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	if len(s1.ApplySqlGather) > 0 {
//		sqlCommit = append(sqlCommit, &begin)
//		sqlCommit = append(sqlCommit, s1.ApplySqlGather...)
//		sqlCommit = append(sqlCommit, &commit)
//	}
//	if !or.WriteTextI.(outPut.Result).AppendWrite("", sqlCommit) {
//		vlog = fmt.Sprintf("(%d) %v %v datafix sql write fail. write sql is {%v},error is {%v}", s1.LogSeq, callFuncInfo, event, s1.ApplySqlGather, err)
//		global.Wlog.Error(vlog)
//		return nil, errors.New(fmt.Sprintf("datafix sql write fail"))
//	}
//	execTimeOut := time.Since(beginTime).Milliseconds()
//	vlog = fmt.Sprintf("(%d) %v %v Write the repair statement of table %v.%v to the repair file successfully. exec timeOut is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, execTimeOut)
//	global.Wlog.Debug(vlog)
//	return execTimeOut, nil
//}
//
//func (or ApplySql) DdlSql(s any) (any, error) {
//	var (
//		event = "[WriteDataFix]"
//		err   error
//	)
//	s1 := s.(global.ApplySqlInput)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	beginTime := time.Now()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//	vlog = fmt.Sprintf("(%d) %v %v  Start writing repair statements of table %v.%v to the repair file.", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	if !or.WriteTextI.(outPut.Result).AppendWrite("", s1.ApplySqlGather) {
//		vlog = fmt.Sprintf("(%d) %v %v datafix sql write fail. write sql is {%v},error is {%v}", s1.LogSeq, callFuncInfo, event, s1.ApplySqlGather, err)
//		global.Wlog.Error(vlog)
//		return nil, errors.New(fmt.Sprintf("datafix sql write fail"))
//	}
//	execTimeOut := time.Since(beginTime).Milliseconds()
//	vlog = fmt.Sprintf("(%d) %v %v Write the repair statement of table %v.%v to the repair file successfully. exec timeOut is {%v}", s1.LogSeq, callFuncInfo, event, or.Schema, or.Table, execTimeOut)
//	global.Wlog.Debug(vlog)
//	return execTimeOut, nil
//}
